package com.zipking.cloud.springbootmybatis.service.impl;

import com.google.common.collect.Maps;
import com.zipking.cloud.springbootmybatis.persistance.entity.MsgLog;
import com.zipking.cloud.springbootmybatis.persistance.mapper.MsgLogMapper;
import org.checkerframework.checker.nullness.qual.Nullable;

import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;

public class ThredQuery implements Callable<List<MsgLog>> {
    /******需要通过构造方法把对应的业务service传进来 实际用的时候把类型变为对应的类型******/
    private MsgLogMapper msgLogMapper;
    /******查询条件 根据条件来定义该类的属性******/
    private Map<String, Object> params;

    /******分页index******/
    private int offset;
    /******数量******/
    private int num;

    public ThredQuery(MsgLogMapper msgLogMapper, Map<String, Object> params, int offset, int num) {
        this.msgLogMapper = msgLogMapper;
        this.params = params;
        this.offset = offset;
        this.num = num;
    }

    @Override
    public List<MsgLog> call() throws Exception {
        /******通过service查询得到对应结果******/
        Map<@Nullable String, @Nullable Object> map = Maps.newHashMap();
        map.put("limit", offset);
        map.put("num", num);
        //queryWrapper .last("limit "+offset+", "+num);
        List<MsgLog> duyanCallRecordDetailList = msgLogMapper.selectListByWhere(map);
        return duyanCallRecordDetailList;
    }


}
